home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MS_ARCAD.ZIP / ARC5_3.CHP < prev    next >
Text File  |  1993-06-15  |  6KB  |  128 lines

  1. %
  2. #EF
  3. #T15,1,Chapter 5     General Design Considerations     Pg. 11
  4. #HS,1,4,80,25,11,1
  5. #C4,R5
  6.                  ~W~IInformation and Implementation Hiding~Y~I
  7.  
  8. Since proper programs are composed of a combination of selection,
  9. iteration, sequence, and recursion, we see that our games will be
  10. completely modular and that there is no room in our programs for GOTO's.
  11. I keep harping on that because I've seen how jumps in and out of modules
  12. can destroy the modifiability of a program.
  13.  
  14. #WN
  15. #C4,R23
  16. In good, modular programs, the implementation is hidden between modules.
  17. #EL,23
  18. #C4,R22
  19. In good, modular programs, the implementation is hidden between modules.
  20. Information is also as well hidden as possible. Implementation hiding is
  21. #ES,1,22,80,23
  22. #C4,R21
  23. In good, modular programs, the implementation is hidden between modules.
  24. Information is also as well hidden as possible. Implementation hiding is
  25. when nothing outside a module 'knows" anything about the way the module
  26. #ES,1,21,80,23
  27. #C4,R20
  28. In good, modular programs, the implementation is hidden between modules.
  29. Information is also as well hidden as possible. Implementation hiding is
  30. when nothing outside a module 'knows" anything about the way the module
  31. is written.
  32. #ES,1,20,80,23
  33. #C4,R19
  34. In good, modular programs, the implementation is hidden between modules.
  35. Information is also as well hidden as possible. Implementation hiding is
  36. when nothing outside a module 'knows" anything about the way the module
  37. is written.
  38. #ES,1,19,80,23
  39. #C4,R18
  40. In good, modular programs, the implementation is hidden between modules.
  41. Information is also as well hidden as possible. Implementation hiding is
  42. when nothing outside a module 'knows" anything about the way the module
  43. is written.
  44. #ES,1,18,80,23
  45. #C4,R17
  46. In good, modular programs, the implementation is hidden between modules.
  47. Information is also as well hidden as possible. Implementation hiding is
  48. when nothing outside a module 'knows" anything about the way the module
  49. is written.
  50. #ES,1,17,80,23
  51. #C4,R16
  52. In good, modular programs, the implementation is hidden between modules.
  53. Information is also as well hidden as possible. Implementation hiding is
  54. when nothing outside a module 'knows" anything about the way the module
  55. is written.
  56. #ES,1,16,80,23
  57. #C4,R15
  58. In good, modular programs, the implementation is hidden between modules.
  59. Information is also as well hidden as possible. Implementation hiding is
  60. when nothing outside a module 'knows" anything about the way the module
  61. is written.
  62. #ES,1,15,80,23
  63. #C4,R14
  64. In good, modular programs, the implementation is hidden between modules.
  65. Information is also as well hidden as possible. Implementation hiding is
  66. when nothing outside a module 'knows" anything about the way the module
  67. is written.
  68. #ES,1,14,80,23
  69. #C4,R13
  70. In good, modular programs, the implementation is hidden between modules.
  71. Information is also as well hidden as possible. Implementation hiding is
  72. when nothing outside a module 'knows" anything about the way the module
  73. is written.
  74.  
  75. #WN
  76. %
  77. #EF
  78. #T15,1,Chapter 5     General Design Considerations     Pg. 12
  79. #HS,1,4,80,25,11,1
  80. #C4,R5
  81. ~Y~IHere's an example. If I want to give my program a nice menued user
  82. interface, I'm going to have to write some routines that will pop up a
  83. horizontal menu across the top of the screen, as well as functions to do
  84. vertical menus. ~SI might even add dialog boxes and help windows.~s ~G~ISince
  85. these functions are conceptually related, I would group them into a single
  86. C source file. ~Y~II would need a set of functions that perform the required
  87. operations on a menu, so I would make a function called ~W~Icreate_menu()~Y~I,
  88. and another called ~W~Idisplay_menu()~Y~I, etc. All of these would be together
  89. in a file I'd call ~W~IMENU.C~Y~I.
  90.  
  91. #WN
  92. The functions ~W~Icreate_menu()~Y~I and ~W~Idisplay_menu()~Y~I would be part of a group of
  93. functions that would form the interface into ~W~IMENU.C~Y~I. There may be other
  94. functions in there which provide support to the interface functions. For
  95. instance, maybe I have a function in ~W~IMENU.C~Y~I called ~W~Iinit_menu()~Y~I. This
  96. function is called by ~W~Icreate_menu()~Y~I, but by ~M~Ino other function~Y~I. It would be
  97. nice if we could help hide the implementation of menus by preventing any
  98. other file from being able to call ~W~Iinit_menu()~Y~I. We can do this by declaring
  99. ~W~Iinit_menu()~Y~I to be of storage class |static|. We'll see examples of how this
  100. is done in the game that we'll write.
  101.  
  102. #WP
  103. %
  104. #EF
  105. #T15,1,Chapter 5     General Design Considerations     Pg. 13
  106. #HS,1,4,80,25,11,1
  107. #C4,R5
  108. ~Y~IWhy is it important to hide the implementation? The primary reason is to
  109. increase the maintainability of the program. If for some reason I need to
  110. change the way that menus are implemented, I can easily do so if no
  111. functions in files outside ~W~IMENU.C~Y~I make a direct reference to the way menus
  112. are implemented. If all functions outside ~W~IMENU.C~Y~I are forced to access the
  113. implementation of a menu through the interface of functions, then we can
  114. change the way menus are implemented. As long as the interface doesn't
  115. change, then the other functions won't be affected.
  116.  
  117. #WN
  118. Information hiding is similar to implementation hiding. If I have a group
  119. of related data, it's nice to put it together into a structure variable
  120. and provide functions and macros that do operations on the data as a unit.
  121.  
  122. #WN
  123. Both information hiding and implementation hiding will be demonstrated in
  124. the game, so you'll be able to see what I mean before you need to do it
  125. yourself.
  126.  
  127. #WP
  128. #X